
export default (app, mode = 'open') => {
  let actions = []

  if (mode === 'open') {
    actions.push({
      label: 'Publish',
      command: 'Publish',
      value: app,
      disabled: app.appStore || app.status === 2,
      icon: 'cuifont icon_arrow-upload'
    })

    actions.push({
      label: 'Edit',
      command: 'Edit',
      value: app,
      icon: 'cuifont icon_edit'
    })

    actions.push({
      label: 'Update',
      command: 'Update',
      value: app,
      disabled: !app.appStore || app.status === 2,
      icon: 'cuifont icon_edit'
    })
    actions.push({
      label: 'Cancel',
      command: 'Cancel',
      value: app,
      disabled: !app.online,
      icon: 'cuifont icon_arrow_download'
    })
    actions.push({
      label: 'Log',
      command: 'Log',
      value: app,
      icon: 'cuifont icon_notepad'
    })
    actions.push({
      label: 'Delete',
      command: 'Delete',
      value: app,
      icon: 'cuifont icon_delete'
    })
  }

  if (mode === 'app') {
    actions.push({
      label: 'Uninstall',
      command: 'Uninstall',
      value: app,
      icon: 'cuifont icon_delete'
    })
  }

  return actions
}
